package web.day02;

import java.io.IOException;
import java.util.Arrays;
import java.util.Map;

import javax.security.auth.message.callback.PrivateKeyCallback.Request;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 演示http请求
 * 
 * 
 * 
 * @author luohui
 *
 */
public class DemoRequest extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//获取请求参数，参数是通过key=value形式传过来，我们可以根据key取到value
//		String name=Request.getParameter("name");
//		System.out.println("name");
//		
//		String password = request.getParameter("password");
//		System.out.println(password);
		
		//包含了所有的请求参数
		Map<String , String[]>map=request.getParameterMap();
		//遍历
		for(<Entry<String,String[]>entry:map.entrySet()) {
			System.out.println("key:" + entry.getKey() + " value:" + Arrays.toString(entry.getValue()));
		}
		//获取多选框请求参数，这种方式只能获取一个
		String skills=request.getParameter("skills");
		System.out.println(skills);
		
		//获取多选框请求参数
		String strings=request.getParameterMap().get("skills");
		System.out.println(Arrays.toString(strings));
	}
}
